<?php
class CommonController extends Base
{
	public $login_user;
	public function __construct(){
		parent::__construct();
		if ($this->controller != 'Login' && $this->controller != 'Ajax') {
			// 检测是否登录
			if (!$this->_checkLogin()) {
				header("Location:".U("login/index"));
			}
		}
		$this->login_user['user_id']		= $_SESSION['user_id'];
		$this->login_user['user_name']		= $_SESSION['user_name'];
	}

	private function _checkLogin(){
		$user_id	= intval($_SESSION['user_id']);
		if (!empty($user_id)) {
			return $user_id;
		} else {
			return false;
		}
	}
}
?>